﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Tong;
using Tong.Fy;
public partial class user_Show : System.Web.UI.Page
{
    public TongUse TextData = new TongUse();
    /// <summary>
    /// 系统安装绝对路径
    /// </summary>
    public string Abs_Path = TongUse.SysPath;
    protected void Page_Load(object sender, EventArgs e)
    {
        Show_useData();

    }

    private void Show_useData()//显示User数据函数
    {

        FenYe 分页类 = new FenYe();
        XdataGrid.DataSource=分页类.Fy("select * from [use] order by Use_id", 10);
        Div.InnerHtml = 分页类.GetHTML;
        XdataGrid.DataBind();
        
    }


    /// <summary>
    /// 还原密码事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void rePwd(object sender, EventArgs e)
    {//((LinkButton)sender)得到linkbutton对象所有的属性,与sender对象一样 就可以使用了哦
       
        int id = int.Parse( ((LinkButton)sender).CommandArgument.ToString());//设定id 
        string pwd = "123456789";//密码 要还原的密码
        pwd = TextData.SHA1Sign(pwd);
        TextData.SqlDataSave("update [Use] Set pwd = '" + pwd + "' where Use_id =  " + id);
        tt.Text = "已成功还原 用户   " + TextData.SqlataSet("select * from [use] where Use_id = " + id).Tables[0].Rows[0]["uid"].ToString() + "   的密码 密码为 123456789 ";
    
    }

    /// <summary>
    /// 编辑事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>

    protected void Use_Edit(object sender, EventArgs e)
    {
        //得到对象属性 ((LinkButton)sender).CommandArgument
        ((LinkButton)sender).CommandArgument.ToString();

        Response.Redirect("~/aspnet/admin/Use/User_Edit.aspx?id=" + ((LinkButton)sender).CommandArgument.ToString() + "&use="+((LinkButton)sender).CommandName.ToString()+"");//转到要编辑的页面 id+ 用户名
    }
}
